library(dplyr)
#library(psych) #for pairs.panels, but could use other packages, e.g. GGalley
library(lavaan)
library(semPlot)
library(DiagrammeR)
library(tidyr)
library(ggplot2)
combined=read.csv("data/annual_averages/annual_data_compiled_regions.csv",stringsAsFactors = F)
cnames=read.csv("analysis/column_names_region.csv", stringsAsFactors = F)
dsub=filter(combined, Year>=1975) %>% arrange(Region,Year)
focaldata=dsub[,cnames$Datacolumn]
fvars=cnames$Shortname
colnames(focaldata)=fvars
regions=unique(focaldata$region)
regionorder=c("West","North","South")
years=1975:2021
focaldata = focaldata %>%
mutate(tzoop=hcope+clad+mysid+pcope,
tzoop_c=hcope_c+clad_c+mysid_c+pcope_c,
tzoop_e=hcope_e+clad_e+mysid_e+pcope_e,
hzoop=hcope+clad,
hzoop_c=hcope_c+clad_c,
hzoop_e=hcope_e+clad_e,
pzoop=mysid+pcope,
pzoop_c=mysid_c+pcope_c,
pzoop_e=mysid_e+pcope_e)
fvars=c(fvars,"tzoop","tzoop_c","tzoop_e",
"hzoop","hzoop_c","hzoop_e",
"pzoop","pzoop_c","pzoop_e")
cnames=rbind(cnames,data.frame(Longname=NA,Shortname=c("tzoop","tzoop_c","tzoop_e",
"hzoop","hzoop_c","hzoop_e",
"pzoop","pzoop_c","pzoop_e"),
Diagramname=c("Total Zooplankton\nBiomass",
"Total Zooplankton\nAbundance",
"Total Zooplankton\nEnergy",
"Herbivorous Zooplankton\nBiomass",
"Herbivorous Zooplankton\nAbundance",
"Herbivorous Zooplankton\nEnergy",
"Predatory Zooplankton\nBiomass",
"Predatory Zooplankton\nAbundance",
"Predatory Zooplankton\nEnergy"),
Datacolumn=NA,Log="yes"))
#focal variables
varnames=c("temp","flow","nitrate","ammonia","dophos","chla","hcope","clad","amphi","pcope","mysid","potam","corbic","sside","estfish_bsot","estfish_bsmt","tzoop","tzoop_c","tzoop_e","hzoop","pzoop")
source("analysis/myLavaanPlot.r")
Log transform, scale
#log transform
logvars=fvars[cnames$Log=="yes"]
logtrans=function(x) {
x2=x[which(!is.na(x))]
if(any(x2==0)) {log(x+min(x2[which(x2>0)],na.rm=T))}
else {log(x)}
}
focaldatalog = focaldata %>%
mutate_at(logvars,logtrans)
#scale data
fdr0=focaldatalog
tvars=fvars[-(1:2)]
fdr=fdr0 %>% group_by(region) %>%
#lag
mutate_at(tvars,list("1"=lag)) %>%
#scale
mutate_at(-(1:2),scale) %>%
ungroup() %>%
as.data.frame()
#detrended data
fdr_dtr=fdr0 %>% group_by(region) %>%
#detrend
mutate_at(tvars,function(x) {
x<<-x
if(!all(is.na(x))) {
if((length(which(x==0))/length(x))<0.5) {
x2<<-x
x2[x2==0]=NA
res<<-residuals(lm(x2~years))
out=x
out[which(!is.na(x2))]=res
return(out)
} else {return(x)}
} else {return(x)}
}) %>%
#lag
mutate_at(tvars,list("1"=lag)) %>%
#scale
mutate_at(-(1:2),scale) %>%
ungroup() %>%
as.data.frame()
(only sig correlations shown… no correction for multiple comparisons)
Fish indices are not correlated in S and N!
l_models = data.frame(l_model = c("tzoop","tzoop_c","tzoop_e",
"hzoop","hzoop+pzoop","pzoop",
"tzoop+amphi","tzoop_e+amphi",
"hcope+clad+mysid",
"hcope+clad+mysid+pcope",
"hcope+clad+mysid+pcope+rotif_m",
"hcope+mysid",
"hcope+mysid+pcope",
"hcope+mysid+amphi"))
#Midwater Trawl
westmods = purrr::map(l_models$l_model, ~lm(paste0("estfish_bsmt ~", .x),
data = filter(fdr_dtr,region=="West")))
names(westmods)=l_models$l_model
bbmle::AICctab(westmods,weights=T,delta=T)
## dAICc df weight
## tzoop_e 0.0 3 0.1725
## tzoop_e+amphi 0.1 4 0.1611
## tzoop 0.2 3 0.1567
## tzoop+amphi 0.2 4 0.1526
## hcope+clad+mysid 0.9 5 0.1085
## hzoop 1.7 3 0.0730
## hzoop+pzoop 2.8 4 0.0436
## pzoop 3.3 3 0.0326
## hcope+clad+mysid+pcope 3.4 6 0.0316
## hcope+mysid 3.7 4 0.0265
## hcope+mysid+amphi 3.9 5 0.0241
## hcope+clad+mysid+pcope+rotif_m 6.1 7 0.0081
## hcope+mysid+pcope 6.2 5 0.0076
## tzoop_c 9.4 3 0.0015
northmods = purrr::map(l_models$l_model, ~lm(paste0("estfish_bsmt ~", .x),
data = filter(fdr_dtr,region=="North")))
names(northmods)=l_models$l_model
bbmle::AICctab(northmods,weights=T,delta=T)
## dAICc df weight
## tzoop+amphi 0.0 4 0.2172
## tzoop_e+amphi 0.4 4 0.1819
## tzoop 0.5 3 0.1652
## tzoop_e 1.1 3 0.1278
## pzoop 1.5 3 0.1042
## hcope+clad+mysid+pcope+rotif_m 2.6 7 0.0587
## hcope+clad+mysid 3.0 5 0.0487
## hcope+clad+mysid+pcope 3.7 6 0.0341
## hzoop+pzoop 3.9 4 0.0306
## hcope+mysid+amphi 5.7 5 0.0126
## hcope+mysid+pcope 6.3 5 0.0092
## hcope+mysid 6.4 4 0.0090
## tzoop_c 12.3 3 <0.001
## hzoop 12.7 3 <0.001
southmods = purrr::map(l_models$l_model, ~lm(paste0("estfish_bsmt ~", .x),
data = filter(fdr_dtr,region=="South")))
names(southmods)=l_models$l_model
bbmle::AICctab(southmods,weights=T,delta=T)
## dAICc df weight
## hzoop 0.0 3 0.1716
## tzoop 0.3 3 0.1481
## tzoop_e 0.3 3 0.1452
## tzoop_c 0.5 3 0.1316
## pzoop 0.9 3 0.1100
## hcope+clad+mysid 2.4 5 0.0521
## hzoop+pzoop 2.4 4 0.0512
## hcope+mysid 2.7 4 0.0451
## tzoop+amphi 2.8 4 0.0433
## tzoop_e+amphi 2.8 4 0.0424
## hcope+clad+mysid+pcope 4.0 6 0.0232
## hcope+mysid+pcope 4.8 5 0.0155
## hcope+mysid+amphi 5.3 5 0.0121
## hcope+clad+mysid+pcope+rotif_m 6.0 7 0.0087
#Otter Trawl
westmods = purrr::map(l_models$l_model, ~lm(paste0("estfish_bsot ~", .x),
data = filter(fdr_dtr,region=="West")))
names(westmods)=l_models$l_model
bbmle::AICctab(westmods,weights=T,delta=T)
## dAICc df weight
## tzoop_e+amphi 0.0 4 0.3213
## tzoop+amphi 0.1 4 0.2991
## hcope+clad+mysid+pcope+rotif_m 0.6 7 0.2373
## hcope+mysid+amphi 2.6 5 0.0874
## hcope+clad+mysid+pcope 6.4 6 0.0131
## hzoop 7.2 3 0.0089
## tzoop_e 7.4 3 0.0081
## hcope+clad+mysid 7.6 5 0.0071
## tzoop 7.6 3 0.0071
## hzoop+pzoop 8.6 4 0.0043
## hcope+mysid+pcope 9.8 5 0.0025
## hcope+mysid 10.0 4 0.0021
## pzoop 10.5 3 0.0017
## tzoop_c 16.4 3 <0.001
northmods = purrr::map(l_models$l_model, ~lm(paste0("estfish_bsot ~", .x),
data = filter(fdr_dtr,region=="North")))
names(northmods)=l_models$l_model
bbmle::AICctab(northmods,weights=T,delta=T)
## dAICc df weight
## pzoop 0.0 3 0.2086
## tzoop 0.7 3 0.1497
## tzoop_e 0.7 3 0.1448
## hcope+mysid 1.7 4 0.0873
## hzoop+pzoop 2.1 4 0.0741
## tzoop_c 2.3 3 0.0665
## tzoop+amphi 2.4 4 0.0632
## tzoop_e+amphi 2.4 4 0.0623
## hcope+mysid+pcope 3.2 5 0.0427
## hzoop 4.0 3 0.0287
## hcope+clad+mysid 4.1 5 0.0273
## hcope+mysid+amphi 4.1 5 0.0264
## hcope+clad+mysid+pcope 5.8 6 0.0116
## hcope+clad+mysid+pcope+rotif_m 6.9 7 0.0067
southmods = purrr::map(l_models$l_model, ~lm(paste0("estfish_bsot ~", .x),
data = filter(fdr_dtr,region=="South")))
names(southmods)=l_models$l_model
bbmle::AICctab(southmods,weights=T,delta=T)
## dAICc df weight
## tzoop_e 0.0 3 0.1736
## tzoop 0.0 3 0.1720
## hzoop 0.4 3 0.1393
## hcope+mysid+pcope 1.4 5 0.0878
## pzoop 1.8 3 0.0707
## tzoop_e+amphi 1.9 4 0.0677
## tzoop+amphi 1.9 4 0.0669
## tzoop_c 1.9 3 0.0663
## hcope+mysid 2.7 4 0.0449
## hzoop+pzoop 2.8 4 0.0418
## hcope+clad+mysid+pcope 3.5 6 0.0304
## hcope+mysid+amphi 4.5 5 0.0183
## hcope+clad+mysid 5.2 5 0.0131
## hcope+clad+mysid+pcope+rotif_m 6.4 7 0.0072
tzoop and tzoop_e do pretty well in all regions. tzoop_c and hzoop+pzoop does poorly in all regions. amphi seem relevant in North (for midwater trawl), which is also where they are most abundant.
l_modelsw = data.frame(l_model = c("tzoop",
"tzoop+marfish_bsmt"))
l_modelsns = data.frame(l_model = c("tzoop",
"tzoop+amphi",
"tzoop+amphi+sside",
"tzoop+sside",
"tzoop+corbic",
"tzoop+corbic+sside"))
#Midwater Trawl
westmods = purrr::map(l_modelsw$l_model, ~lm(paste0("estfish_bsmt ~", .x),
data = filter(fdr_dtr,region=="West")))
names(westmods)=l_modelsw$l_model
bbmle::AICctab(westmods,weights=T,delta=T)
## dAICc df weight
## tzoop 0.0 3 0.74
## tzoop+marfish_bsmt 2.1 4 0.26
northmods = purrr::map(l_modelsns$l_model, ~lm(paste0("estfish_bsmt ~", .x),
data = filter(fdr_dtr,region=="North")))
names(northmods)=l_modelsns$l_model
bbmle::AICctab(northmods,weights=T,delta=T)
## dAICc df weight
## tzoop+amphi+sside 0.0 5 0.323
## tzoop+sside 0.3 4 0.279
## tzoop+corbic+sside 1.5 5 0.154
## tzoop+amphi 2.1 4 0.114
## tzoop 2.6 3 0.087
## tzoop+corbic 4.1 4 0.043
southmods = purrr::map(l_modelsns$l_model, ~lm(paste0("estfish_bsmt ~", .x),
data = filter(fdr_dtr,region=="South")))
names(southmods)=l_modelsns$l_model
bbmle::AICctab(southmods,weights=T,delta=T)
## dAICc df weight
## tzoop+corbic 0.0 4 0.454
## tzoop+corbic+sside 1.9 5 0.173
## tzoop 2.1 3 0.162
## tzoop+sside 2.5 4 0.128
## tzoop+amphi 4.5 4 0.047
## tzoop+amphi+sside 5.1 5 0.035
With and without detrending.
#west has no ssides, corbic
#1
# modwest='zoop=~hcope+mysid
# fish=~estfish_bsmt+estfish_bsot
# zoop~chla+potam+flow
# chla~potam+flow
# fish~zoop+flow
# '
#2
# modwest='chla~potam+flow
# tzoop~chla+potam+flow
# estfish_bsmt~tzoop+flow
# estfish_bsot~tzoop+flow
# '
#3
modwest='chla~potam+flow+temp+secchi
tzoop~chla+potam+flow+temp+secchi
amphi~chla+potam+flow+temp+secchi
estfish_bsmt~tzoop+amphi+flow+temp+secchi
estfish_bsot~tzoop+amphi+flow+temp+secchi
amphi~~tzoop
'
modfitwest=sem(modwest, data=filter(fdr,region=="West"))
modfitwest_dtr=sem(modwest, data=filter(fdr_dtr,region=="West"))
summary(modfitwest, standardized=T, rsq=T)
## lavaan 0.6-4 ended normally after 42 iterations
##
## Optimization method NLMINB
## Number of free parameters 31
##
## Used Total
## Number of observations 40 47
##
## Estimator ML
## Model Fit Test Statistic 3.172
## Degrees of freedom 4
## P-value (Chi-square) 0.529
##
## Parameter Estimates:
##
## Information Expected
## Information saturated (h1) model Structured
## Standard Errors Standard
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## chla ~
## potam -0.361 0.148 -2.438 0.015 -0.361 -0.422
## flow 0.148 0.153 0.964 0.335 0.148 0.179
## temp 0.010 0.131 0.074 0.941 0.010 0.011
## secchi 0.126 0.196 0.640 0.522 0.126 0.124
## tzoop ~
## chla 0.819 0.088 9.314 0.000 0.819 0.780
## potam -0.156 0.088 -1.773 0.076 -0.156 -0.174
## flow 0.032 0.086 0.374 0.708 0.032 0.037
## temp 0.191 0.073 2.621 0.009 0.191 0.212
## secchi 0.074 0.110 0.671 0.502 0.074 0.069
## amphi ~
## chla 0.050 0.143 0.352 0.725 0.050 0.047
## potam 0.298 0.143 2.080 0.038 0.298 0.324
## flow 0.377 0.140 2.682 0.007 0.377 0.423
## temp -0.376 0.119 -3.165 0.002 -0.376 -0.406
## secchi 0.458 0.178 2.568 0.010 0.458 0.422
## estfish_bsmt ~
## tzoop 0.631 0.130 4.853 0.000 0.631 0.572
## amphi 0.045 0.150 0.299 0.765 0.045 0.042
## flow 0.303 0.143 2.125 0.034 0.303 0.317
## temp 0.057 0.123 0.463 0.643 0.057 0.057
## secchi -0.161 0.174 -0.925 0.355 -0.161 -0.138
## estfish_bsot ~
## tzoop 0.643 0.120 5.378 0.000 0.643 0.585
## amphi 0.061 0.138 0.445 0.656 0.061 0.057
## flow 0.559 0.131 4.261 0.000 0.559 0.586
## temp 0.002 0.113 0.021 0.984 0.002 0.002
## secchi 0.400 0.160 2.496 0.013 0.400 0.343
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .tzoop ~~
## .amphi -0.176 0.054 -3.283 0.001 -0.176 -0.607
## .estfish_bsmt ~~
## .estfish_bsot 0.095 0.060 1.567 0.117 0.095 0.256
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla 0.578 0.129 4.472 0.000 0.578 0.793
## .tzoop 0.179 0.040 4.472 0.000 0.179 0.223
## .amphi 0.472 0.106 4.472 0.000 0.472 0.560
## .estfish_bsmt 0.402 0.090 4.472 0.000 0.402 0.412
## .estfish_bsot 0.340 0.076 4.472 0.000 0.340 0.351
##
## R-Square:
## Estimate
## chla 0.207
## tzoop 0.777
## amphi 0.440
## estfish_bsmt 0.588
## estfish_bsot 0.649
summary(modfitwest_dtr, standardized=T, rsq=T)
## lavaan 0.6-4 ended normally after 37 iterations
##
## Optimization method NLMINB
## Number of free parameters 31
##
## Used Total
## Number of observations 40 47
##
## Estimator ML
## Model Fit Test Statistic 9.115
## Degrees of freedom 4
## P-value (Chi-square) 0.058
##
## Parameter Estimates:
##
## Information Expected
## Information saturated (h1) model Structured
## Standard Errors Standard
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## chla ~
## potam 0.037 0.157 0.236 0.814 0.037 0.039
## flow 0.321 0.178 1.799 0.072 0.321 0.342
## temp -0.287 0.166 -1.736 0.083 -0.287 -0.298
## secchi 0.466 0.234 1.994 0.046 0.466 0.388
## tzoop ~
## chla 0.819 0.104 7.883 0.000 0.819 0.778
## potam -0.034 0.103 -0.329 0.742 -0.034 -0.034
## flow 0.133 0.122 1.093 0.274 0.133 0.135
## temp 0.128 0.113 1.138 0.255 0.128 0.126
## secchi 0.260 0.161 1.614 0.107 0.260 0.205
## amphi ~
## chla 0.228 0.143 1.595 0.111 0.228 0.237
## potam 0.058 0.142 0.407 0.684 0.058 0.063
## flow 0.336 0.168 2.004 0.045 0.336 0.372
## temp -0.196 0.155 -1.265 0.206 -0.196 -0.211
## secchi 0.233 0.222 1.053 0.292 0.233 0.201
## estfish_bsmt ~
## tzoop 0.449 0.127 3.536 0.000 0.449 0.459
## amphi 0.078 0.143 0.545 0.585 0.078 0.073
## flow 0.368 0.165 2.221 0.026 0.368 0.381
## temp 0.020 0.142 0.144 0.885 0.020 0.021
## secchi -0.082 0.219 -0.375 0.707 -0.082 -0.066
## estfish_bsot ~
## tzoop 0.286 0.097 2.941 0.003 0.286 0.290
## amphi 0.180 0.109 1.649 0.099 0.180 0.167
## flow 0.683 0.127 5.379 0.000 0.683 0.701
## temp -0.131 0.109 -1.208 0.227 -0.131 -0.131
## secchi 0.744 0.168 4.436 0.000 0.744 0.595
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .tzoop ~~
## .amphi -0.249 0.083 -3.008 0.003 -0.249 -0.541
## .estfish_bsmt ~~
## .estfish_bsot 0.090 0.067 1.341 0.180 0.090 0.217
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla 0.775 0.173 4.472 0.000 0.775 0.840
## .tzoop 0.335 0.075 4.472 0.000 0.335 0.327
## .amphi 0.633 0.141 4.472 0.000 0.633 0.739
## .estfish_bsmt 0.540 0.121 4.472 0.000 0.540 0.553
## .estfish_bsot 0.317 0.071 4.472 0.000 0.317 0.319
##
## R-Square:
## Estimate
## chla 0.160
## tzoop 0.673
## amphi 0.261
## estfish_bsmt 0.447
## estfish_bsot 0.681
# par(mfrow=c(1,2))
# semPaths(modfitwest, "std", edge.label.cex = 1, residuals = F)
# semPaths(modfitwest, "par", edge.label.cex = 1, residuals = F)
labelswest <- createLabels(modfitwest, cnames)
# residuals(modfitwest)
# modificationindices(modfitwest)
#1
# modnorth='zoop=~hcope+mysid
# #fish=~estfish_bsmt+estfish_bsot
# zoop~chla+potam+flow
# chla~potam+flow
# estfish_bsmt~zoop+flow
# estfish_bsot~zoop+flow
# '
# modnorth='zoop=~clad
# zoop~chla+corbic+potam+flow
# chla~corbic+potam+flow
# estfish_bsmt~zoop+flow+sside+chla
# estfish_bsot~zoop+flow+sside+chla
# '
#2
# modnorth='chla~corbic+potam+flow
# tzoop~chla+corbic+potam+flow
# estfish_bsmt~tzoop+flow+chla
# estfish_bsot~tzoop+flow
# '
#3
modnorth='chla~corbic+potam+flow+temp+secchi
tzoop~chla+corbic+potam+flow+temp+secchi
amphi~chla+corbic+potam+flow+temp+secchi
estfish_bsmt~tzoop+amphi+flow+temp+secchi+chla+sside
estfish_bsot~tzoop+amphi+flow+temp+secchi+sside
amphi~~tzoop
'
modfitnorth=sem(modnorth, data=filter(fdr,region=="North"))
modfitnorth_dtr=sem(modnorth, data=filter(fdr_dtr,region=="North"))
summary(modfitnorth, standardized=T, rsq=T)
## lavaan 0.6-4 ended normally after 45 iterations
##
## Optimization method NLMINB
## Number of free parameters 37
##
## Used Total
## Number of observations 40 47
##
## Estimator ML
## Model Fit Test Statistic 7.441
## Degrees of freedom 8
## P-value (Chi-square) 0.490
##
## Parameter Estimates:
##
## Information Expected
## Information saturated (h1) model Structured
## Standard Errors Standard
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## chla ~
## corbic 0.285 0.136 2.100 0.036 0.285 0.335
## potam -0.166 0.144 -1.153 0.249 -0.166 -0.192
## flow 0.072 0.147 0.493 0.622 0.072 0.085
## temp 0.186 0.143 1.300 0.194 0.186 0.212
## secchi -0.142 0.139 -1.022 0.307 -0.142 -0.144
## tzoop ~
## chla 0.520 0.082 6.364 0.000 0.520 0.469
## corbic 0.356 0.074 4.814 0.000 0.356 0.378
## potam -0.008 0.076 -0.110 0.913 -0.008 -0.009
## flow -0.281 0.076 -3.693 0.000 -0.281 -0.297
## temp 0.285 0.076 3.776 0.000 0.285 0.293
## secchi -0.297 0.073 -4.066 0.000 -0.297 -0.271
## amphi ~
## chla 0.326 0.139 2.342 0.019 0.326 0.300
## corbic 0.367 0.126 2.917 0.004 0.367 0.398
## potam -0.071 0.129 -0.546 0.585 -0.071 -0.075
## flow -0.054 0.130 -0.417 0.677 -0.054 -0.058
## temp -0.481 0.129 -3.737 0.000 -0.481 -0.503
## secchi 0.169 0.124 1.358 0.174 0.169 0.157
## estfish_bsmt ~
## tzoop -0.392 0.227 -1.730 0.084 -0.392 -0.386
## amphi 0.332 0.152 2.187 0.029 0.332 0.320
## flow 0.115 0.136 0.848 0.397 0.115 0.119
## temp 0.536 0.176 3.046 0.002 0.536 0.540
## secchi 0.127 0.149 0.851 0.395 0.127 0.114
## chla 0.716 0.201 3.567 0.000 0.716 0.635
## sside -0.175 0.159 -1.105 0.269 -0.175 -0.141
## estfish_bsot ~
## tzoop 0.490 0.195 2.515 0.012 0.490 0.498
## amphi -0.038 0.171 -0.224 0.823 -0.038 -0.038
## flow 0.203 0.147 1.375 0.169 0.203 0.217
## temp 0.016 0.201 0.080 0.936 0.016 0.017
## secchi 0.229 0.170 1.350 0.177 0.229 0.213
## sside -0.337 0.182 -1.856 0.063 -0.337 -0.279
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .tzoop ~~
## .amphi -0.007 0.037 -0.180 0.857 -0.007 -0.028
## .estfish_bsmt ~~
## .estfish_bsot -0.051 0.078 -0.658 0.511 -0.051 -0.105
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla 0.511 0.114 4.472 0.000 0.511 0.670
## .tzoop 0.137 0.031 4.472 0.000 0.137 0.146
## .amphi 0.396 0.089 4.472 0.000 0.396 0.440
## .estfish_bsmt 0.429 0.096 4.472 0.000 0.429 0.441
## .estfish_bsot 0.563 0.126 4.472 0.000 0.563 0.619
##
## R-Square:
## Estimate
## chla 0.330
## tzoop 0.854
## amphi 0.560
## estfish_bsmt 0.559
## estfish_bsot 0.381
summary(modfitnorth_dtr, standardized=T, rsq=T)
## lavaan 0.6-4 ended normally after 32 iterations
##
## Optimization method NLMINB
## Number of free parameters 37
##
## Used Total
## Number of observations 40 47
##
## Estimator ML
## Model Fit Test Statistic 7.241
## Degrees of freedom 8
## P-value (Chi-square) 0.511
##
## Parameter Estimates:
##
## Information Expected
## Information saturated (h1) model Structured
## Standard Errors Standard
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## chla ~
## corbic 0.426 0.169 2.516 0.012 0.426 0.421
## potam 0.061 0.154 0.398 0.691 0.061 0.065
## flow 0.094 0.180 0.521 0.603 0.094 0.097
## temp 0.156 0.171 0.914 0.361 0.156 0.158
## secchi -0.280 0.159 -1.756 0.079 -0.280 -0.278
## tzoop ~
## chla 0.647 0.091 7.092 0.000 0.647 0.618
## corbic 0.376 0.105 3.575 0.000 0.376 0.355
## potam 0.031 0.089 0.343 0.731 0.031 0.031
## flow -0.373 0.104 -3.572 0.000 -0.373 -0.368
## temp 0.283 0.100 2.835 0.005 0.283 0.273
## secchi -0.126 0.095 -1.316 0.188 -0.126 -0.119
## amphi ~
## chla 0.291 0.111 2.637 0.008 0.291 0.303
## corbic 0.460 0.127 3.609 0.000 0.460 0.473
## potam 0.057 0.108 0.528 0.597 0.057 0.063
## flow -0.049 0.126 -0.385 0.700 -0.049 -0.052
## temp -0.412 0.121 -3.404 0.001 -0.412 -0.432
## secchi -0.039 0.116 -0.340 0.734 -0.039 -0.041
## estfish_bsmt ~
## tzoop 0.044 0.176 0.249 0.804 0.044 0.047
## amphi 0.273 0.145 1.886 0.059 0.273 0.267
## flow 0.274 0.129 2.126 0.034 0.274 0.289
## temp 0.489 0.148 3.300 0.001 0.489 0.503
## secchi -0.017 0.105 -0.160 0.873 -0.017 -0.017
## chla 0.365 0.168 2.172 0.030 0.365 0.373
## sside -0.162 0.112 -1.446 0.148 -0.162 -0.152
## estfish_bsot ~
## tzoop 0.274 0.173 1.582 0.114 0.274 0.289
## amphi 0.027 0.196 0.137 0.891 0.027 0.026
## flow 0.170 0.166 1.023 0.306 0.170 0.177
## temp -0.004 0.203 -0.019 0.985 -0.004 -0.004
## secchi 0.278 0.143 1.938 0.053 0.278 0.279
## sside -0.256 0.154 -1.662 0.097 -0.256 -0.238
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .tzoop ~~
## .amphi 0.013 0.049 0.267 0.789 0.013 0.042
## .estfish_bsmt ~~
## .estfish_bsot -0.005 0.084 -0.062 0.950 -0.005 -0.010
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla 0.773 0.173 4.472 0.000 0.773 0.795
## .tzoop 0.257 0.058 4.472 0.000 0.257 0.242
## .amphi 0.378 0.084 4.472 0.000 0.378 0.421
## .estfish_bsmt 0.387 0.087 4.472 0.000 0.387 0.415
## .estfish_bsot 0.731 0.163 4.472 0.000 0.731 0.768
##
## R-Square:
## Estimate
## chla 0.205
## tzoop 0.758
## amphi 0.579
## estfish_bsmt 0.585
## estfish_bsot 0.232
# par(mfrow=c(1,2))
# semPaths(modfitnorth, "std", edge.label.cex = 1, residuals = F)
# semPaths(modfitnorth, "par", edge.label.cex = 1, residuals = F)
labelsnorth <- createLabels(modfitnorth, cnames)
# residuals(modfitnorth)
# modificationindices(modfitnorth)
#no potam
#1
# modsouth='zoop=~hcope+mysid
# #fish=~estfish_bsmt+estfish_bsot
# zoop~chla+corbic+flow
# chla~corbic+flow
# estfish_bsmt~zoop+flow
# estfish_bsot~zoop+flow
# '
#2
# modsouth='chla~corbic+flow
# tzoop~chla+corbic+flow
# estfish_bsmt~tzoop+flow+corbic+sside
# estfish_bsot~tzoop+flow+corbic+sside
# '
#3
modsouth='chla~corbic+flow+temp+secchi
tzoop~chla+corbic+flow+temp+secchi
amphi~chla+corbic+flow+temp+secchi
estfish_bsmt~tzoop+amphi+flow+temp+secchi+corbic+sside
estfish_bsot~tzoop+amphi+flow+temp+secchi+corbic+sside
amphi~~tzoop
'
modfitsouth=sem(modsouth, data=filter(fdr,region=="South"))
modfitsouth_dtr=sem(modsouth, data=filter(fdr_dtr,region=="South"))
summary(modfitsouth, standardized=T, rsq=T)
## lavaan 0.6-4 ended normally after 33 iterations
##
## Optimization method NLMINB
## Number of free parameters 35
##
## Used Total
## Number of observations 40 47
##
## Estimator ML
## Model Fit Test Statistic 6.015
## Degrees of freedom 5
## P-value (Chi-square) 0.305
##
## Parameter Estimates:
##
## Information Expected
## Information saturated (h1) model Structured
## Standard Errors Standard
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## chla ~
## corbic 0.158 0.147 1.076 0.282 0.158 0.155
## flow 0.159 0.149 1.067 0.286 0.159 0.163
## temp 0.440 0.148 2.979 0.003 0.440 0.438
## secchi -0.318 0.152 -2.092 0.036 -0.318 -0.286
## tzoop ~
## chla 0.569 0.107 5.309 0.000 0.569 0.593
## corbic 0.185 0.101 1.825 0.068 0.185 0.188
## flow -0.020 0.102 -0.196 0.844 -0.020 -0.021
## temp 0.240 0.111 2.162 0.031 0.240 0.248
## secchi -0.013 0.109 -0.121 0.904 -0.013 -0.012
## amphi ~
## chla 0.062 0.146 0.425 0.671 0.062 0.084
## corbic -0.053 0.138 -0.387 0.699 -0.053 -0.070
## flow -0.115 0.139 -0.827 0.408 -0.115 -0.159
## temp 0.136 0.151 0.904 0.366 0.136 0.183
## secchi 0.078 0.148 0.526 0.599 0.078 0.095
## estfish_bsmt ~
## tzoop -0.194 0.180 -1.073 0.283 -0.194 -0.192
## amphi 0.003 0.173 0.016 0.988 0.003 0.002
## flow -0.096 0.151 -0.639 0.523 -0.096 -0.102
## temp 0.050 0.171 0.293 0.770 0.050 0.051
## secchi -0.458 0.232 -1.971 0.049 -0.458 -0.425
## corbic 0.402 0.175 2.297 0.022 0.402 0.406
## sside -0.058 0.301 -0.193 0.847 -0.058 -0.046
## estfish_bsot ~
## tzoop 0.242 0.174 1.390 0.165 0.242 0.250
## amphi 0.117 0.167 0.703 0.482 0.117 0.093
## flow -0.101 0.146 -0.697 0.486 -0.101 -0.112
## temp -0.089 0.165 -0.537 0.591 -0.089 -0.095
## secchi 0.332 0.224 1.481 0.139 0.332 0.322
## corbic 0.293 0.169 1.735 0.083 0.293 0.308
## sside -0.553 0.290 -1.906 0.057 -0.553 -0.455
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .tzoop ~~
## .amphi 0.070 0.060 1.173 0.241 0.070 0.189
## .estfish_bsmt ~~
## .estfish_bsot -0.006 0.090 -0.067 0.946 -0.006 -0.011
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla 0.596 0.133 4.472 0.000 0.596 0.573
## .tzoop 0.274 0.061 4.472 0.000 0.274 0.286
## .amphi 0.507 0.113 4.472 0.000 0.507 0.890
## .estfish_bsmt 0.587 0.131 4.472 0.000 0.587 0.602
## .estfish_bsot 0.548 0.122 4.472 0.000 0.548 0.610
##
## R-Square:
## Estimate
## chla 0.427
## tzoop 0.714
## amphi 0.110
## estfish_bsmt 0.398
## estfish_bsot 0.390
summary(modfitsouth_dtr, standardized=T, rsq=T)
## lavaan 0.6-4 ended normally after 23 iterations
##
## Optimization method NLMINB
## Number of free parameters 35
##
## Used Total
## Number of observations 40 47
##
## Estimator ML
## Model Fit Test Statistic 4.485
## Degrees of freedom 5
## P-value (Chi-square) 0.482
##
## Parameter Estimates:
##
## Information Expected
## Information saturated (h1) model Structured
## Standard Errors Standard
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## chla ~
## corbic 0.064 0.158 0.408 0.683 0.064 0.063
## flow 0.208 0.175 1.189 0.234 0.208 0.213
## temp 0.450 0.173 2.599 0.009 0.450 0.447
## secchi 0.004 0.151 0.025 0.980 0.004 0.004
## tzoop ~
## chla 0.550 0.113 4.859 0.000 0.550 0.552
## corbic 0.134 0.113 1.185 0.236 0.134 0.133
## flow -0.017 0.128 -0.131 0.896 -0.017 -0.017
## temp 0.261 0.134 1.949 0.051 0.261 0.260
## secchi 0.137 0.108 1.266 0.206 0.137 0.137
## amphi ~
## chla 0.085 0.122 0.695 0.487 0.085 0.113
## corbic -0.007 0.122 -0.060 0.952 -0.007 -0.010
## flow -0.114 0.138 -0.829 0.407 -0.114 -0.155
## temp 0.156 0.145 1.082 0.279 0.156 0.206
## secchi -0.044 0.117 -0.373 0.709 -0.044 -0.058
## estfish_bsmt ~
## tzoop -0.208 0.174 -1.191 0.234 -0.208 -0.213
## amphi 0.024 0.202 0.118 0.906 0.024 0.019
## flow -0.106 0.173 -0.612 0.541 -0.106 -0.111
## temp 0.048 0.188 0.254 0.800 0.048 0.049
## secchi -0.211 0.169 -1.252 0.210 -0.211 -0.217
## corbic 0.374 0.170 2.205 0.027 0.374 0.378
## sside -0.029 0.202 -0.144 0.885 -0.029 -0.025
## estfish_bsot ~
## tzoop 0.084 0.157 0.535 0.592 0.084 0.087
## amphi 0.211 0.182 1.157 0.247 0.211 0.166
## flow -0.094 0.156 -0.603 0.546 -0.094 -0.100
## temp -0.122 0.170 -0.718 0.472 -0.122 -0.126
## secchi 0.388 0.152 2.556 0.011 0.388 0.405
## corbic 0.221 0.153 1.449 0.147 0.221 0.227
## sside -0.330 0.182 -1.815 0.070 -0.330 -0.285
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .tzoop ~~
## .amphi 0.110 0.077 1.419 0.156 0.110 0.230
## .estfish_bsmt ~~
## .estfish_bsot -0.028 0.114 -0.241 0.809 -0.028 -0.038
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla 0.863 0.193 4.472 0.000 0.863 0.835
## .tzoop 0.442 0.099 4.472 0.000 0.442 0.431
## .amphi 0.516 0.115 4.472 0.000 0.516 0.879
## .estfish_bsmt 0.801 0.179 4.472 0.000 0.801 0.822
## .estfish_bsot 0.650 0.145 4.472 0.000 0.650 0.684
##
## R-Square:
## Estimate
## chla 0.165
## tzoop 0.569
## amphi 0.121
## estfish_bsmt 0.178
## estfish_bsot 0.316
# par(mfrow=c(1,2))
# semPaths(modfitsouth, "std", edge.label.cex = 1, residuals = F)
# semPaths(modfitsouth, "par", edge.label.cex = 1, residuals = F)
labelssouth <- createLabels(modfitsouth, cnames)
# residuals(modfitsouth)
# modificationindices(modfitsouth)
Original units
West
North
South
Detrended
West
North
South
With and without detrending.
#west has no ssides, corbic
modwest='chla~potam
potam~flow
hzoop~chla+potam+flow
pzoop~chla+potam+flow+hzoop
estfish_bsmt~hzoop+pzoop+flow
estfish_bsot~hzoop+pzoop+flow
'
modfitwest=sem(modwest, data=filter(fdr,region=="West"))
modfitwest_dtr=sem(modwest, data=filter(fdr_dtr,region=="West"))
summary(modfitwest, standardized=T, rsq=T)
## lavaan 0.6-4 ended normally after 33 iterations
##
## Optimization method NLMINB
## Number of free parameters 22
##
## Used Total
## Number of observations 40 47
##
## Estimator ML
## Model Fit Test Statistic 5.981
## Degrees of freedom 5
## P-value (Chi-square) 0.308
##
## Parameter Estimates:
##
## Information Expected
## Information saturated (h1) model Structured
## Standard Errors Standard
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## chla ~
## potam -0.370 0.122 -3.036 0.002 -0.370 -0.433
## potam ~
## flow -0.430 0.137 -3.133 0.002 -0.430 -0.444
## hzoop ~
## chla 0.665 0.103 6.463 0.000 0.665 0.678
## potam -0.142 0.096 -1.478 0.139 -0.142 -0.170
## flow 0.085 0.086 0.987 0.323 0.085 0.104
## pzoop ~
## chla 0.498 0.127 3.924 0.000 0.498 0.481
## potam -0.057 0.085 -0.673 0.501 -0.057 -0.065
## flow -0.209 0.075 -2.793 0.005 -0.209 -0.244
## hzoop 0.476 0.136 3.491 0.000 0.476 0.451
## estfish_bsmt ~
## hzoop 0.040 0.218 0.182 0.856 0.040 0.034
## pzoop 0.611 0.196 3.112 0.002 0.611 0.556
## flow 0.434 0.111 3.911 0.000 0.434 0.460
## estfish_bsot ~
## hzoop 0.144 0.220 0.655 0.512 0.144 0.124
## pzoop 0.517 0.198 2.609 0.009 0.517 0.471
## flow 0.410 0.112 3.662 0.000 0.410 0.436
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .estfish_bsmt ~~
## .estfish_bsot 0.062 0.066 0.946 0.344 0.062 0.151
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla 0.592 0.132 4.472 0.000 0.592 0.813
## .potam 0.801 0.179 4.472 0.000 0.801 0.803
## .hzoop 0.251 0.056 4.472 0.000 0.251 0.358
## .pzoop 0.187 0.042 4.472 0.000 0.187 0.239
## .estfish_bsmt 0.407 0.091 4.472 0.000 0.407 0.430
## .estfish_bsot 0.414 0.093 4.472 0.000 0.414 0.440
##
## R-Square:
## Estimate
## chla 0.187
## potam 0.197
## hzoop 0.642
## pzoop 0.761
## estfish_bsmt 0.570
## estfish_bsot 0.560
summary(modfitwest_dtr, standardized=T, rsq=T)
## lavaan 0.6-4 ended normally after 26 iterations
##
## Optimization method NLMINB
## Number of free parameters 22
##
## Used Total
## Number of observations 40 47
##
## Estimator ML
## Model Fit Test Statistic 8.863
## Degrees of freedom 5
## P-value (Chi-square) 0.115
##
## Parameter Estimates:
##
## Information Expected
## Information saturated (h1) model Structured
## Standard Errors Standard
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## chla ~
## potam -0.061 0.150 -0.409 0.682 -0.061 -0.065
## potam ~
## flow -0.423 0.141 -2.996 0.003 -0.423 -0.428
## hzoop ~
## chla 0.669 0.109 6.121 0.000 0.669 0.681
## potam -0.048 0.115 -0.420 0.675 -0.048 -0.052
## flow 0.138 0.113 1.217 0.223 0.138 0.150
## pzoop ~
## chla 0.417 0.121 3.446 0.001 0.417 0.468
## potam 0.068 0.092 0.739 0.460 0.068 0.080
## flow -0.163 0.092 -1.772 0.076 -0.163 -0.195
## hzoop 0.347 0.126 2.752 0.006 0.347 0.382
## estfish_bsmt ~
## hzoop 0.052 0.176 0.296 0.767 0.052 0.051
## pzoop 0.475 0.192 2.468 0.014 0.475 0.424
## flow 0.473 0.124 3.816 0.000 0.473 0.505
## estfish_bsot ~
## hzoop 0.152 0.175 0.871 0.384 0.152 0.148
## pzoop 0.429 0.191 2.244 0.025 0.429 0.379
## flow 0.440 0.123 3.578 0.000 0.440 0.466
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .estfish_bsmt ~~
## .estfish_bsot 0.080 0.086 0.938 0.348 0.080 0.150
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla 0.919 0.205 4.472 0.000 0.919 0.996
## .potam 0.836 0.187 4.472 0.000 0.836 0.817
## .hzoop 0.439 0.098 4.472 0.000 0.439 0.494
## .pzoop 0.278 0.062 4.472 0.000 0.278 0.380
## .estfish_bsmt 0.540 0.121 4.472 0.000 0.540 0.586
## .estfish_bsot 0.533 0.119 4.472 0.000 0.533 0.568
##
## R-Square:
## Estimate
## chla 0.004
## potam 0.183
## hzoop 0.506
## pzoop 0.620
## estfish_bsmt 0.414
## estfish_bsot 0.432
labelswest <- createLabels(modfitwest, cnames)
# residuals(modfitwest)
# modificationindices(modfitwest)
modnorth='chla~corbic+potam
potam~flow
corbic~flow
hzoop~chla+corbic+potam+flow
pzoop~chla+corbic+potam+flow+hzoop
estfish_bsmt~hzoop+pzoop+flow
estfish_bsot~hzoop+pzoop+flow
'
modfitnorth=sem(modnorth, data=filter(fdr,region=="North"))
modfitnorth_dtr=sem(modnorth, data=filter(fdr_dtr,region=="North"))
summary(modfitnorth, standardized=T, rsq=T)
## lavaan 0.6-4 ended normally after 24 iterations
##
## Optimization method NLMINB
## Number of free parameters 27
##
## Used Total
## Number of observations 40 47
##
## Estimator ML
## Model Fit Test Statistic 13.130
## Degrees of freedom 8
## P-value (Chi-square) 0.107
##
## Parameter Estimates:
##
## Information Expected
## Information saturated (h1) model Structured
## Standard Errors Standard
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## chla ~
## corbic 0.363 0.118 3.086 0.002 0.363 0.435
## potam -0.130 0.120 -1.083 0.279 -0.130 -0.153
## potam ~
## flow -0.498 0.134 -3.708 0.000 -0.498 -0.506
## corbic ~
## flow 0.398 0.146 2.721 0.007 0.398 0.395
## hzoop ~
## chla 0.283 0.158 1.796 0.072 0.283 0.275
## corbic 0.319 0.138 2.316 0.021 0.319 0.370
## potam 0.086 0.138 0.626 0.531 0.086 0.098
## flow -0.282 0.143 -1.971 0.049 -0.282 -0.325
## pzoop ~
## chla 0.673 0.099 6.826 0.000 0.673 0.593
## corbic 0.332 0.088 3.762 0.000 0.332 0.350
## potam 0.041 0.083 0.489 0.625 0.041 0.042
## flow -0.346 0.090 -3.843 0.000 -0.346 -0.363
## hzoop 0.222 0.095 2.336 0.020 0.222 0.202
## estfish_bsmt ~
## hzoop -0.175 0.183 -0.953 0.341 -0.175 -0.157
## pzoop 0.586 0.165 3.544 0.000 0.586 0.582
## flow 0.258 0.129 1.999 0.046 0.258 0.268
## estfish_bsot ~
## hzoop 0.167 0.178 0.936 0.349 0.167 0.152
## pzoop 0.439 0.161 2.734 0.006 0.439 0.443
## flow 0.231 0.125 1.842 0.065 0.231 0.244
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .estfish_bsmt ~~
## .estfish_bsot 0.005 0.104 0.049 0.961 0.005 0.008
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla 0.563 0.126 4.472 0.000 0.563 0.761
## .potam 0.754 0.169 4.472 0.000 0.754 0.744
## .corbic 0.893 0.200 4.472 0.000 0.893 0.844
## .hzoop 0.559 0.125 4.472 0.000 0.559 0.712
## .pzoop 0.203 0.045 4.472 0.000 0.203 0.213
## .estfish_bsmt 0.679 0.152 4.472 0.000 0.679 0.700
## .estfish_bsot 0.640 0.143 4.472 0.000 0.640 0.682
##
## R-Square:
## Estimate
## chla 0.239
## potam 0.256
## corbic 0.156
## hzoop 0.288
## pzoop 0.787
## estfish_bsmt 0.300
## estfish_bsot 0.318
summary(modfitnorth_dtr, standardized=T, rsq=T)
## lavaan 0.6-4 ended normally after 23 iterations
##
## Optimization method NLMINB
## Number of free parameters 27
##
## Used Total
## Number of observations 40 47
##
## Estimator ML
## Model Fit Test Statistic 7.125
## Degrees of freedom 8
## P-value (Chi-square) 0.523
##
## Parameter Estimates:
##
## Information Expected
## Information saturated (h1) model Structured
## Standard Errors Standard
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## chla ~
## corbic 0.353 0.152 2.325 0.020 0.353 0.349
## potam 0.028 0.141 0.195 0.845 0.028 0.029
## potam ~
## flow -0.421 0.148 -2.841 0.004 -0.421 -0.410
## corbic ~
## flow 0.371 0.139 2.657 0.008 0.371 0.387
## hzoop ~
## chla 0.214 0.131 1.628 0.103 0.214 0.242
## corbic 0.067 0.143 0.472 0.637 0.067 0.076
## potam 0.006 0.127 0.047 0.963 0.006 0.007
## flow -0.373 0.140 -2.666 0.008 -0.373 -0.437
## pzoop ~
## chla 0.672 0.094 7.115 0.000 0.672 0.632
## corbic 0.355 0.100 3.551 0.000 0.355 0.329
## potam 0.121 0.089 1.368 0.171 0.121 0.121
## flow -0.414 0.106 -3.916 0.000 -0.414 -0.403
## hzoop 0.095 0.110 0.858 0.391 0.095 0.078
## estfish_bsmt ~
## hzoop 0.116 0.159 0.730 0.466 0.116 0.103
## pzoop 0.544 0.127 4.286 0.000 0.544 0.580
## flow 0.375 0.131 2.875 0.004 0.375 0.389
## estfish_bsot ~
## hzoop -0.037 0.190 -0.195 0.845 -0.037 -0.032
## pzoop 0.373 0.151 2.464 0.014 0.373 0.395
## flow 0.176 0.155 1.131 0.258 0.176 0.181
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .estfish_bsmt ~~
## .estfish_bsot 0.072 0.112 0.648 0.517 0.072 0.103
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla 0.854 0.191 4.472 0.000 0.854 0.880
## .potam 0.911 0.204 4.472 0.000 0.911 0.832
## .corbic 0.806 0.180 4.472 0.000 0.806 0.850
## .hzoop 0.588 0.131 4.472 0.000 0.588 0.781
## .pzoop 0.286 0.064 4.472 0.000 0.286 0.260
## .estfish_bsmt 0.590 0.132 4.472 0.000 0.590 0.611
## .estfish_bsot 0.836 0.187 4.472 0.000 0.836 0.855
##
## R-Square:
## Estimate
## chla 0.120
## potam 0.168
## corbic 0.150
## hzoop 0.219
## pzoop 0.740
## estfish_bsmt 0.389
## estfish_bsot 0.145
labelsnorth <- createLabels(modfitnorth, cnames)
# residuals(modfitnorth)
# modificationindices(modfitnorth)
#no potam
modsouth='chla~corbic
corbic~flow
hzoop~chla+corbic+flow
pzoop~chla+corbic+flow+hzoop
estfish_bsmt~hzoop+pzoop+flow+corbic
estfish_bsot~hzoop+pzoop+flow+corbic
'
modfitsouth=sem(modsouth, data=filter(fdr,region=="South"))
modfitsouth_dtr=sem(modsouth, data=filter(fdr_dtr,region=="South"))
summary(modfitsouth, standardized=T, rsq=T)
## lavaan 0.6-4 ended normally after 24 iterations
##
## Optimization method NLMINB
## Number of free parameters 24
##
## Used Total
## Number of observations 40 47
##
## Estimator ML
## Model Fit Test Statistic 0.105
## Degrees of freedom 3
## P-value (Chi-square) 0.991
##
## Parameter Estimates:
##
## Information Expected
## Information saturated (h1) model Structured
## Standard Errors Standard
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## chla ~
## corbic 0.442 0.146 3.027 0.002 0.442 0.432
## corbic ~
## flow 0.301 0.143 2.101 0.036 0.301 0.315
## hzoop ~
## chla 0.526 0.120 4.393 0.000 0.526 0.536
## corbic 0.329 0.128 2.572 0.010 0.329 0.327
## flow -0.209 0.111 -1.883 0.060 -0.209 -0.218
## pzoop ~
## chla 0.642 0.120 5.359 0.000 0.642 0.685
## corbic 0.015 0.114 0.135 0.893 0.015 0.016
## flow -0.047 0.095 -0.497 0.619 -0.047 -0.052
## hzoop 0.151 0.130 1.164 0.244 0.151 0.159
## estfish_bsmt ~
## hzoop -0.342 0.179 -1.913 0.056 -0.342 -0.346
## pzoop 0.318 0.171 1.854 0.064 0.318 0.308
## flow -0.065 0.134 -0.489 0.625 -0.065 -0.069
## corbic 0.563 0.161 3.496 0.000 0.563 0.568
## estfish_bsot ~
## hzoop 0.043 0.173 0.249 0.803 0.043 0.045
## pzoop 0.142 0.166 0.854 0.393 0.142 0.143
## flow -0.132 0.130 -1.017 0.309 -0.132 -0.145
## corbic 0.457 0.156 2.928 0.003 0.457 0.480
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .estfish_bsmt ~~
## .estfish_bsot -0.027 0.102 -0.268 0.789 -0.027 -0.042
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla 0.846 0.189 4.472 0.000 0.846 0.814
## .corbic 0.894 0.200 4.472 0.000 0.894 0.901
## .hzoop 0.485 0.108 4.472 0.000 0.485 0.484
## .pzoop 0.328 0.073 4.472 0.000 0.328 0.359
## .estfish_bsmt 0.662 0.148 4.472 0.000 0.662 0.679
## .estfish_bsot 0.622 0.139 4.472 0.000 0.622 0.691
##
## R-Square:
## Estimate
## chla 0.186
## corbic 0.099
## hzoop 0.516
## pzoop 0.641
## estfish_bsmt 0.321
## estfish_bsot 0.309
summary(modfitsouth_dtr, standardized=T, rsq=T)
## lavaan 0.6-4 ended normally after 19 iterations
##
## Optimization method NLMINB
## Number of free parameters 24
##
## Used Total
## Number of observations 40 47
##
## Estimator ML
## Model Fit Test Statistic 0.126
## Degrees of freedom 3
## P-value (Chi-square) 0.988
##
## Parameter Estimates:
##
## Information Expected
## Information saturated (h1) model Structured
## Standard Errors Standard
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## chla ~
## corbic 0.151 0.159 0.951 0.341 0.151 0.149
## corbic ~
## flow 0.238 0.147 1.614 0.107 0.238 0.247
## hzoop ~
## chla 0.483 0.125 3.857 0.000 0.483 0.484
## corbic 0.312 0.131 2.371 0.018 0.312 0.307
## flow -0.237 0.125 -1.892 0.059 -0.237 -0.242
## pzoop ~
## chla 0.579 0.139 4.174 0.000 0.579 0.572
## corbic -0.094 0.133 -0.707 0.480 -0.094 -0.091
## flow -0.085 0.123 -0.686 0.493 -0.085 -0.086
## hzoop 0.186 0.149 1.245 0.213 0.186 0.184
## estfish_bsmt ~
## hzoop -0.340 0.173 -1.967 0.049 -0.340 -0.350
## pzoop 0.093 0.158 0.590 0.555 0.093 0.097
## flow -0.110 0.146 -0.751 0.452 -0.110 -0.116
## corbic 0.415 0.160 2.597 0.009 0.415 0.420
## estfish_bsot ~
## hzoop 0.044 0.171 0.260 0.795 0.044 0.046
## pzoop 0.027 0.156 0.175 0.861 0.027 0.029
## flow -0.172 0.145 -1.187 0.235 -0.172 -0.183
## corbic 0.366 0.158 2.312 0.021 0.366 0.375
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .estfish_bsmt ~~
## .estfish_bsot -0.087 0.128 -0.676 0.499 -0.087 -0.107
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla 1.011 0.226 4.472 0.000 1.011 0.978
## .corbic 0.939 0.210 4.472 0.000 0.939 0.939
## .hzoop 0.635 0.142 4.472 0.000 0.635 0.615
## .pzoop 0.567 0.127 4.472 0.000 0.567 0.535
## .estfish_bsmt 0.814 0.182 4.472 0.000 0.814 0.834
## .estfish_bsot 0.797 0.178 4.472 0.000 0.797 0.840
##
## R-Square:
## Estimate
## chla 0.022
## corbic 0.061
## hzoop 0.385
## pzoop 0.465
## estfish_bsmt 0.166
## estfish_bsot 0.160
labelssouth <- createLabels(modfitsouth, cnames)
# residuals(modfitsouth)
# modificationindices(modfitsouth)
Original units
West
North
South
Detrended
West
North
South